package com.example.blank.Dao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.HashMap;

import com.example.blank.utils.DBConnectionUtils;

public class TeacherDao {
	
	public static HashMap getTeacherDetail(String teacher_id)
	{
		
		Statement statement = null;
		Connection connection = null;
		ResultSet resultSet = null;
		try{
			
			connection = DBConnectionUtils.getConnection(connection);
			statement = connection.createStatement();
			resultSet = statement.executeQuery("select * from teacher where teacher_id="+teacher_id);
			resultSet.last();
			if(resultSet.getRow()<=0)
			{
				System.out.println("0");
				return null;
			}
			
			resultSet.first();
			do{
				
				HashMap map = new HashMap();
				map.put("teacher_id", resultSet.getString(1));
				map.put("teacher_name", resultSet.getString(2));
				map.put("teacher_position", resultSet.getString(3));
				map.put("teacher_message", resultSet.getString(4));
				map.put("teacher_tel", resultSet.getString(5));
				map.put("teacher_e_mail", resultSet.getString(6));
				return map;
				
				
			}while(resultSet.next());
			
		}catch(Exception e)
		{
			e.printStackTrace();
			System.out.println("++++++++++"+e.getMessage());
			return null;
		}
	}

}
